/*
 * @Author: 迷洛洛ywc
 * @Date: 2024-02-21 17:07:16
 * @LastEditors: 迷洛洛ywc
 * @LastEditTime: 2024-06-12 14:16:12
 * @Description: file content
 */
import Vue from 'vue'
import Vuex from 'vuex'
import createPersistedState from 'vuex-persistedstate'

Vue.use(Vuex)

export default new Vuex.Store({
  // 你的存储配置
  state: {
    suyuan: {},
    editData: {},
    report: {
      reportList: [], // 缓存列表，回显
      pesticideReportList: []
    }

  },
  mutations: {
    setValue (state, payload) {
      state.suyuan = payload
    },
    removeValue (state) {
      state.suyuan = {}
    },
    // 编辑信息
    setEditData (state, payload) {
      state.editData = payload
    },
    removeEditData (state) {
      state.editData = {}
    },
    // 报告列表
    setReportList (state, payload) {
      state.report.reportList = payload
    },
    setPesticideReportList (state, payload) {
      state.report.pesticideReportList = payload
    },
    removeReport (state) {
      state.report = {
        reportList: [],
        pesticideReportList: []
      }
    }
  },
  actions: {
  },
  modules: {
  },
  plugins: [createPersistedState()] // 添加这一行以启用本地持久化
})
